<?php
/**
 * Created by PhpStorm.
 * User: chenzhitao
 * Date: 2018/6/21
 * Time: 下午3:27
 */

namespace app\index\service;


use app\index\model\Consult;

class ConsultService
{
    const INDEX_CONSULT_LIST_KEY = "rec_consult_list_key";
    const CONSULT_NUM_KEY = "consult_total_num_key";
    const EXPIRE_IN = 60*5;
    public static function getIndexRecList(){
        $data = cache(self::INDEX_CONSULT_LIST_KEY);
        if($data){
            return $data;
        }
        $list =  Consult::getRecList();
        cache(self::INDEX_CONSULT_LIST_KEY,$list,self::EXPIRE_IN);
        return $list;
    }
    public static function getAllConsultNum(){
        $data = cache(self::CONSULT_NUM_KEY);
        if($data){
            return $data;
        }
        $count = Consult::getTotalNum();
        cache(self::CONSULT_NUM_KEY,$count,self::EXPIRE_IN);
        return $count;

    }

}